#include "Service.h"



std::string ServiceItem::getIp() const
{
    return ip;
}

int ServiceItem::getPort() const{
    return port;
}
std::string ServiceItem::getName() const{
    return name;
}

void Service::addService(ServiceItem service)
{   
    service_list.emplace_back(service);
}

std::vector<ServiceItem> Service::getServiceList()
{
    return service_list;
}

void Service::removeService(ServiceItem service)
{
    for(auto it = service_list.begin(); it != service_list.end(); it++){
        if(it->getIp() == service.getIp() && it->getPort() == service.getPort() && it->getName() == service.getName()){
            service_list.erase(it);
            break;
        }
    }
}